package com.blb.service.impl;

import com.blb.entity.Role;
import com.blb.entity.User;
import com.blb.mapper.RoleMapper;
import com.blb.service.IRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author QuJiaHao
 * @since 2019-11-16
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    @Resource
    private RoleMapper roleMapper;

    @Override
    public void delUserAndRole(Integer roleid) {
        roleMapper.delUserAndRole(roleid);
    }

    @Override
    public void delRoleAndUser(String userid) {
        roleMapper.delRoleAndUser(userid);
    }

    @Override
    public void addUserAndRole(String userId, int roleId) {
        roleMapper.addUserAndRole(userId,roleId);
    }

    @Override
    public Integer getIdByname(String rolename, String roledescribe) {
        return roleMapper.getIdByname(rolename, roledescribe);
    }

    @Override
    public Role getRoleByname(String roleName, String companyId) {
        return roleMapper.getRoleByname(roleName, companyId);
    }

    @Override
    public List<User> getUserByRoleId() {
        return roleMapper.getUserByRoleId();
    }

    @Override
    public List<User> getUserStaff(String companyId) {
        return roleMapper.getUserStaff(companyId);
    }

    @Override
    public List<Role> getRoleStatusByUserId(String id) {
        return roleMapper.getRoleStatusByUserId(id);
    }

    @Override
    public List<String> getOpt(Integer roleId) {
        return roleMapper.getOpt(roleId);
    }

    @Override
    public List<String> getUserStaffOpt(String companyId,Integer roleId) {
        return roleMapper.getUserStaffOpt(companyId, roleId);
    }
}
